{% extends './layout.html' %} {% block title %} {{ title }} {% endblock %}{% block crumbs %}
<a href="/">首页</a>
<a href="/story">小说管理</a>
<a><cite>{{data.bookname}}</cite></a>
{% endblock %}{% block body %}
<div class="layout_title">
	<h3><strong>章节列表</strong></h3>
	<a class="layui-btn layui-btn-sm" href="/story/{{data.bookno}}/add"><i class="layui-icon layui-icon-add-circle-fine"></i> 新增章节</a>
	<a class="layui-btn layui-btn-danger layui-btn-sm" href="/story/{{data.bookno}}/sync"><i class="layui-icon layui-icon-refresh"></i> 同步章节</a>
</div>
<div class="chapter_list" id="chapterList">{{list}}
	<ul>
	</ul>
</div>
<div class="chapter_page" id="chapterPage"></div>
{% endblock %}{% block scripts %}
<script type="text/javascript">
	layui.use(['laypage', 'jquery'], function() {
		var $ = layui.jquery;
		var laypage = layui.laypage;
		/*$.get(window.location.href + '/getChapter').then(function(result) {
			laypage.render({
				elem: 'chapterPage',
				count: result.list.length,
				limit: 80,
				layout: ['count', 'prev', 'page', 'next'],
				jump: function(obj) {
					//模拟渲染
					console.log(obj)
					$('#chapterList ul').html(function() {
						var arr = [];
						var thisData = result.list.concat().splice(obj.curr * obj.limit - obj.limit, obj.limit);
						layui.each(thisData, function(index, item) {
							arr.push('<li class="layui-col-xs12 layui-col-sm6 layui-col-md3"><p>第' + item.id + '章 '+item.title+'</p><a class="layui-btn layui-btn-xs" href="/chapter/{{data.bookno}}/edit?cid='+item.id+'"><i class="layui-icon">&#xe642;</i></a></li>');
						});
						return arr.join('');
					}());
				}
			});
		});*/
	});
</script>
{% endblock %}